package com.aegis.core.constants;

/**
 * @Author renogo
 * 
 * @Version 1.0
 * @Descritube
 */
public class AegisTokenRedisConstants {

    public static final String MODULE_NAME = "aegis:core";

    public static final String MODULE_NAME_APP = MODULE_NAME + ":app";

    public static final String MODULE_NAME_USER = MODULE_NAME + ":user";

    public static final String USER_PERMISSION = MODULE_NAME_USER + ":permission";

    public static final String APP_GROUP = MODULE_NAME_USER + ":app_group";

    public static final String USER_INFO = MODULE_NAME_USER + ":user_info";

    public static final String APP_INFO_KEY = MODULE_NAME_APP + ":app_info";

    public static final String LOGIN_USER_INFO = MODULE_NAME_USER + ":data_clean:login_user_info";


    private AegisTokenRedisConstants() {
        throw new IllegalStateException("Utility class");
    }

    /**
     * 查询用户权限key
     *
     * @param userId
     * @return
     */
    public static String getUserInfoRedisKey(Object userId) {
        return USER_INFO + ":" + userId;
    }


    /**
     * 查询用户权限key
     *
     * @param userId
     * @return
     */
    public static String getUserPermission(String appId, Object userId) {
        return USER_PERMISSION + ":" + appId + ":" + userId;
    }

    /**
     * 查询应用分组key
     *
     * @param appId
     * @return
     */
    public static String getAppGroup(String appId) {
        return APP_GROUP + ":" + appId;
    }


    /**
     * 查询已登录过的用户
     *
     * @param appId
     * @return
     */
    public static String getDataCleanLoginUser(String appId) {
        return LOGIN_USER_INFO + ":" + appId;
    }

}
